package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class Chassis extends Hardware implements Comparable<Chassis>,
		Serializable {

	private static final long serialVersionUID = -4638114973441419262L;
	private int id;
	// 型号1
	private String model;// 机箱型号

	// 外键品牌表1
	private BRD_CHA brand;// 机箱品牌

	// 外键码表4
	private Value type;// 机箱类型
	private Value structure;// 机箱结构
	private Value chassisMaterial;// 机箱材质
	private Value wireFuction;// 理线功能

	// 一对多关系
	private Set<Cha_Interface> intfSet;// 机箱接口
	private Set<Cha_MBArchitect> mbaSet;// 支持主板架构

	// 次要指标13
	private int extendSlot;// 扩展插槽
	private int c525;// 5.25英寸仓位
	private int c35;// 3.5英寸仓位
	private int c25;// 2.5英寸仓位
	private String chasissSize;// 机箱尺寸
	private double chasissWeight;// 机箱重量
	private int toolFreeAssemble;// 免工具拆装
	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保详细内容
	private String attachment;// 附件

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private String rsv2;// 预留信息
	private String rsv3;// 预留信息

	public Set<Cha_Interface> getIntfSet() {
		return intfSet;
	}

	public void setIntfSet(Set<Cha_Interface> intfSet) {
		this.intfSet = intfSet;
	}

	public Set<Cha_MBArchitect> getMbaSet() {
		return mbaSet;
	}

	public void setMbaSet(Set<Cha_MBArchitect> mbaSet) {
		this.mbaSet = mbaSet;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public BRD_CHA getBrand() {
		return brand;
	}

	public void setBrand(BRD_CHA brand) {
		this.brand = brand;
	}

	public Value getType() {
		return type;
	}

	public void setType(Value type) {
		this.type = type;
	}

	public Value getStructure() {
		return structure;
	}

	public void setStructure(Value structure) {
		this.structure = structure;
	}

	public Value getChassisMaterial() {
		return chassisMaterial;
	}

	public void setChassisMaterial(Value chassisMaterial) {
		this.chassisMaterial = chassisMaterial;
	}

	public Value getWireFuction() {
		return wireFuction;
	}

	public void setWireFuction(Value wireFuction) {
		this.wireFuction = wireFuction;
	}

	public int getExtendSlot() {
		return extendSlot;
	}

	public void setExtendSlot(int extendSlot) {
		this.extendSlot = extendSlot;
	}

	public int getC525() {
		return c525;
	}

	public void setC525(int c525) {
		this.c525 = c525;
	}

	public int getC35() {
		return c35;
	}

	public void setC35(int c35) {
		this.c35 = c35;
	}

	public int getC25() {
		return c25;
	}

	public void setC25(int c25) {
		this.c25 = c25;
	}

	public String getChasissSize() {
		return chasissSize;
	}

	public void setChasissSize(String chasissSize) {
		this.chasissSize = chasissSize;
	}

	public double getChasissWeight() {
		return chasissWeight;
	}

	public void setChasissWeight(double chasissWeight) {
		this.chasissWeight = chasissWeight;
	}

	public int getToolFreeAssemble() {
		return toolFreeAssemble;
	}

	public void setToolFreeAssemble(int toolFreeAssemble) {
		this.toolFreeAssemble = toolFreeAssemble;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

	public String getAttachment() {
		return attachment;
	}

	public void setAttachment(String attachment) {
		this.attachment = attachment;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public String getRsv2() {
		return rsv2;
	}

	public void setRsv2(String rsv2) {
		this.rsv2 = rsv2;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(Chassis o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000));

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000)) + 1;

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

}
